import request from '@/api/request';


/**
 * 分页.
 * @param {*} query 参数
 * @returns
 */
export const userPageApi = query => {
    return request({
        url: '/api/mgt/user/page',
        method: 'get',
        params: query,
        isLoading: true
    });
};

/**
 * 详情扩展
 * @param {*} query 参数
 * @returns
 */
export const userDetailExtendApi = query => {
    return request({
        url: '/api/mgt/user/getDetailExtend',
        method: 'get',
        params: query,
        isLoading: true
    });
};

/**
 * 获取登录用户信息
 * @param {*} query 参数
 * @returns
 */
export const userGetUserInfoApi = query => {
    return request({
        url: '/api/mgt/user/getUserInfo',
        method: 'get',
        params: query,
        isLoading: true
    });
};

/**
 * 通过条件模糊搜索
 * @param {*} query 参数
 * @returns
 */
export const userListByConditionApi = query => {
    return request({
        url: '/api/mgt/user/listByCondition',
        method: 'get',
        params: query,
        isLoading: true
    });
};

/**
 * 获取GA二维码
 * @param {*} query 参数
 * @returns
 */
export const userGetGaQrcodeApi = query => {
    return request({
        url: '/api/mgt/user/getGaQrcode',
        method: 'get',
        params: query,
        isLoading: true
    });
};

/**
 * 用户注册（短信方式）
 * @param {*} query 参数
 * @returns
 */
export const userSaveBySmsApi = query => {
    return request({
        url: '/api/mgt/user/saveBySms',
        method: 'post',
        data: query,
        isLoading: true
    });
};

/**
 * 添加
 * @param {*} query 参数
 * @returns
 */
export const userSaveApi = query => {
    return request({
        url: '/api/mgt/user/save',
        method: 'post',
        data: query,
        isLoading: true
    });
};

/**
 * 给组织添加用户
 * @param {*} query 参数
 * @returns
 */
export const userSaveOrgUserApi = query => {
    return request({
        url: '/api/mgt/user/saveOrgUser',
        method: 'post',
        data: query,
        isLoading: true
    });
};

/**
 * 编辑
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const userEditApi = query => {
    return request({
        url: '/api/mgt/user/edit',
        method: 'put',
        data: query,
        isLoading: true
    });
};

/**
 * 编辑账号状态
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const userEditEnabledApi = query => {
    return request({
        url: '/api/mgt/user/editEnabled',
        method: 'put',
        params: query,
        isLoading: true
    });
};

/**
 * 修改密码
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const userEditPasswordApi = query => {
    return request({
        url: '/api/mgt/user/editPassword',
        method: 'put',
        data: query,
        isLoading: true
    });
};

/**
 * 授权角色
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const userEditBatchRoleApi = query => {
    return request({
        url: '/api/mgt/user/editBatchRole',
        method: 'put',
        data: query,
        isLoading: true
    });
};

/**
 * 授权用户组
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const userEditBatchUserGroupApi = query => {
    return request({
        url: '/api/mgt/user/editBatchUserGroup',
        method: 'put',
        data: query,
        isLoading: true
    });
};

/**
 * 删除
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const userRemoveApi = query => {
    return request({
        url: '/api/mgt/user/removeByIds',
        method: 'delete',
        params: query,
        isLoading: true
    });
};

/**
 * 校验用户是否切换过客户端/组织
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const userEditChangeOrgApi = query => {
    return request({
        url: '/api/mgt/user/editChangeOrg',
        method: 'put',
        params: query,
        isLoading: true
    });
};

/**
 * 编辑GA绑定状态
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const userEditGaBindFlagApi = query => {
    return request({
        url: '/api/mgt/user/editGaBindFlag',
        method: 'put',
        params: query,
        isLoading: true
    });
};

/**
 * 编辑重置GA
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const userEditResetGaApi = query => {
    return request({
        url: '/api/mgt/user/editResetGa',
        method: 'put',
        params: query,
        isLoading: true
    });
};



